home *** CD-ROM | disk | FTP | other *** search
/ Interactive CD-ROM & Web Magazine 6 / Interactive CD-ROM & Web Magazine 6.iso / pc / tms / truemod.mst < prev   
Encoding:
Text File  |  1995-07-11  |  10.0 KB  |  295 lines

  1. '**************************************************************************
  2. '*                       MSSetup Toolkit Sample 1
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9. '$INCLUDE 'msregdb.inc'
  10.  
  11. ''Dialog ID's
  12. CONST WELCOME       = 100
  13. CONST ASKQUIT       = 200
  14. CONST DESTPATH      = 300
  15. CONST EXITFAILURE   = 400
  16. CONST EXITQUIT      = 600
  17. CONST EXITSUCCESS   = 700
  18. CONST OPTIONS       = 800
  19. CONST APPHELP       = 900
  20. CONST BADPATH       = 6400
  21.  
  22. ''Bitmap ID
  23. CONST LOGO = 1
  24.  
  25. GLOBAL DEST$        ''Default destination directory.
  26. GLOBAL OPTCUR$      ''Option selection from option dialog.
  27.  
  28. DECLARE SUB Install
  29. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  30.  
  31.  
  32. ' Maximize Code
  33. CONST SW_SHOWMAXIMIZED=3
  34. DECLARE FUNCTION ShowWindow  LIB "user.exe" (hWnd%,iShow%) AS INTEGER
  35.  
  36. ' Remove the Title Bar Code
  37. CONST WS_VISIBLE=&H10000000
  38. CONST WS_BORDER =&H00800000
  39. CONST WS_CLIPCHILDREN = &H02000000
  40. CONST GWL_STYLE =-16
  41.     
  42. DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%, offset%, style&) AS LONG
  43. DECLARE FUNCTION SetWindowPos LIB "user.exe" (hWnd%, hWndAfter%, x%, y%, cx%, cy%, Flags%) AS INTEGER
  44. DECLARE FUNCTION WinExec LIB "krnl386.exe" (CmdLine$, CmdShow%) AS INTEGER
  45.  
  46. INIT:
  47.     hWnd%=HwndFrame()
  48.     junk%=ShowWindow(hWnd%,SW_SHOWMAXIMIZED)
  49.  
  50.     i1&=SetWindowLong(hWnd%,GWL_STYLE,WS_VISIBLE+WS_BORDER+WS_CLIPCHILDREN)
  51.     i2%=ShowWindow(hWnd%,SW_SHOWMAXIMIZED)
  52.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  53.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  54.  
  55.     SetBitmap CUIDLL$, LOGO
  56.     SetTitle "HTI TrueMotion-S Playback Setup"
  57.  
  58.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  59.     IF szInf$ = "" THEN
  60.         szInf$ = GetSymbolValue("STF_CWDDIR") + "truemod.INF"
  61.     END IF
  62.     ReadInfFile szInf$
  63.  
  64.     OPTCUR$ = "1"
  65.     DEST$ = GetWindowsDir
  66.  
  67.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  68.     WinDrive$ = MID$(GetWindowsDir, 1, 1)
  69.     IF IsDriveValid(WinDrive$) = 0 THEN
  70.         i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  71.         GOTO QUIT
  72.     END IF
  73.  
  74.  
  75. WELCOME:
  76.    sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  77.    IF sz$ = "CONTINUE" THEN
  78.       UIPop 1
  79.       '****************************************************************************************
  80.       '********************* Check For NT *****************************************************
  81.       '****************************************************************************************
  82.        OSIS% = IsOSNT()
  83.        IF OSIS% = 1 THEN
  84.            o% = DoMsgBox("You can not install the Windows 3.1 version of the TrueMotion-S Decompressor on Windows NT.", "HTI TrueMotion-S Playback Setup",MB_TASKMODAL+MB_OK+MB_ICONEXCLAMATION)
  85.            RETURN
  86.       END IF
  87.       '****************************************************************************************
  88.       '********************* Check For WIN32 Versions of the Code******************************
  89.       '****************************************************************************************
  90.       '// Check for the WIN32 Decompressor
  91.       SrcDir$ = GetSymbolValue("STF_SRCDIR")
  92.       
  93.       IF DoesFileExist(DEST$+"system\truew32d.dll", femExists) = 1 THEN
  94.          IF DoesFileExist(DEST$+"system\truew32c.dll", femExists) = 1 THEN
  95.             CANDD% = DoMsgBox("WIN32 versions of the TrueMotion-S Compressor and Decompressor exist. Do you wish to continue and remove them?", "HTI TrueMotion-S Playback Setup",MB_TASKMODAL+MB_YESNO+MB_ICONQUESTION)
  96.             IF CANDD% = IDYES THEN
  97.                RemoveFile DEST$+"system\truemo32.drv", cmoForce
  98.                RemoveFile DEST$+"system\truew32d.dll", cmoForce
  99.                RemoveFile DEST$+"system\truew32c.dll", cmoForce
  100.                RemoveFile DEST$+"system\imagew32.dll", cmoForce
  101.                RemoveFile "c:\tmot\tmot.dat", cmoForce
  102.                T1%=RemoveTheDir("c:\tmot")
  103.                RemoveIniKey DEST$+"system.ini", "drivers32", "vidc.tmot", cmoVital
  104.            T%=WinExec(SrcDir$+"\drivers\DelRegKy.EXE SOFTWARE\HTI\TrueMotion-S", SW_SHOWMAXIMIZED)
  105.                T%=WinExec(SrcDir$+"\drivers\DelRegKy.EXE System\CurrentControlSet\Control\MediaResources\icm\vidc.tmot", SW_SHOWMAXIMIZED)
  106.         ELSE
  107.            GOSUB ASKQUIT
  108.            GOTO WELCOME
  109.             END IF
  110.          ELSE
  111.             CANDD% = DoMsgBox("A WIN32 version of the TrueMotion-S Decompressor exists. Do you wish to continue and remove it?", "HTI TrueMotion-S Playback Setup",MB_TASKMODAL+MB_YESNO+MB_ICONQUESTION)
  112.             IF CANDD% = IDYES THEN
  113.                RemoveFile DEST$+"system\truemo32.drv", cmoForce
  114.                RemoveFile DEST$+"system\truew32d.dll", cmoForce
  115.                RemoveIniKey DEST$+"system.ini", "drivers32", "vidc.tmot", cmoVital
  116.            T%=WinExec(SrcDir$+"\drivers\DelRegKy.EXE SOFTWARE\HTI\TrueMotion-S", SW_SHOWMAXIMIZED)
  117.                T%=WinExec(SrcDir$+"\drivers\DelRegKy.EXE System\CurrentControlSet\Control\MediaResources\icm\vidc.tmot", SW_SHOWMAXIMIZED)
  118.         ELSE
  119.            GOSUB ASKQUIT
  120.            GOTO WELCOME
  121.             END IF
  122.          END IF
  123.       ELSE
  124.          IF DoesFileExist(DEST$+"system\truew32c.dll", femExists) = 1 THEN
  125.             CANDD% = DoMsgBox("A WIN32 version of the TrueMotion-S Compressor exists. Do you wish to continue and remove it?", "HTI TrueMotion-S Playback Setup",MB_TASKMODAL+MB_YESNO+MB_ICONQUESTION)
  126.             IF CANDD% = IDYES THEN
  127.            RemoveFile DEST$+"system\truemo32.drv", cmoForce
  128.                RemoveFile DEST$+"system\truew32c.dll", cmoForce
  129.                RemoveFile DEST$+"system\imagew32.dll", cmoForce
  130.                RemoveFile "c:\tmot\tmot.dat", cmoForce
  131.                T2%=RemoveTheDir("c:\tmot")
  132.                RemoveIniKey DEST$+"system.ini", "drivers32", "vidc.tmot", cmoVital
  133.            T%=WinExec(SrcDir$+"\drivers\DelRegKy.EXE SOFTWARE\HTI\TrueMotion-S", SW_SHOWMAXIMIZED)
  134.                T%=WinExec(SrcDir$+"\drivers\DelRegKy.EXE System\CurrentControlSet\Control\MediaResources\icm\vidc.tmot", SW_SHOWMAXIMIZED)
  135.         ELSE
  136.            GOSUB ASKQUIT
  137.            GOTO WELCOME
  138.             END IF
  139.          END IF
  140.       END IF
  141.    ELSE
  142.        GOSUB ASKQUIT
  143.        GOTO WELCOME
  144.    END IF
  145.  
  146.  
  147.  
  148. GETPATH:
  149.     SetSymbolValue "EditTextIn", DEST$
  150.     SetSymbolValue "EditFocus", "END"
  151. GETPATHL1:
  152. '    sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  153. '   DEST$ = GetSymbolValue("EditTextOut")
  154.     sz$ = "CONTINUE"
  155.     IF sz$ = "CONTINUE" THEN
  156.         IF IsDirWritable(DEST$) = 0 THEN
  157.             GOSUB BADPATH
  158.             GOTO GETPATHL1
  159.         END IF
  160.         UIPop 1
  161.     ELSEIF sz$ = "REACTIVATE" THEN
  162.         GOTO GETPATHL1
  163.     ELSEIF sz$ = "BACK" THEN
  164.         UIPop 1
  165.         GOTO GETPATH
  166.     ELSE
  167.         GOSUB ASKQUIT
  168.         GOTO GETPATH
  169.     END IF
  170.  
  171.  
  172.     Install
  173.  
  174.  
  175. QUIT:
  176.     ON ERROR GOTO ERRQUIT
  177.  
  178.     IF ERR = 0 THEN
  179.         dlg% = EXITSUCCESS
  180.     ELSEIF ERR = STFQUIT THEN
  181.         dlg% = EXITQUIT
  182.     ELSE
  183.         dlg% = EXITFAILURE
  184.     END IF
  185. QUITL1:
  186.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  187.     IF sz$ = "REACTIVATE" THEN
  188.         GOTO QUITL1
  189.     END IF
  190.     UIPop 1
  191.  
  192.     END
  193.  
  194. ERRQUIT:
  195.     i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  196.     END
  197.  
  198.  
  199.  
  200. BADPATH:
  201.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  202.     IF sz$ = "REACTIVATE" THEN
  203.         GOTO BADPATH
  204.     END IF
  205.     UIPop 1
  206.     RETURN
  207.  
  208.  
  209.  
  210. ASKQUIT:
  211.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  212.  
  213.     IF sz$ = "EXIT" THEN
  214.         UIPopAll
  215.         ERROR STFQUIT
  216.     ELSEIF sz$ = "REACTIVATE" THEN
  217.         GOTO ASKQUIT
  218.     ELSE
  219.         UIPop 1
  220.     END IF
  221.     RETURN
  222.  
  223.  
  224.  
  225. '**
  226. '** Purpose:
  227. '**     Builds the copy list and performs all installation operations.
  228. '** Arguments:
  229. '**     none.
  230. '** Returns:
  231. '**     none.
  232. '*************************************************************************
  233. SUB Install STATIC
  234.  
  235.     DCI% = DoMsgBox("Does Your System Support DCI Video Hardware Acceleration?", "HTI TrueMotion-S Setup",MB_TASKMODAL+MB_YESNO+MB_ICONQUESTION)
  236.  
  237.     IF DCI% = IDYES THEN
  238.         CreateIniKeyValue "WIN.INI", "TrueMotion", "videohardware", "ON" , cmoOverwrite
  239.     ELSE
  240.         CreateIniKeyValue "WIN.INI", "TrueMotion", "videohardware", "OFF" , cmoOverwrite
  241.     END IF
  242.  
  243.  
  244.     BlackLine% = DoMsgBox("Do You Want To Display Black Lines With Zoomed Video?","HTI TrueMotion-S", MB_TASKMODAL+MB_YESNO+MB_ICONQUESTION)
  245.     
  246.     IF BlackLine% = IDYES THEN
  247.         CreateIniKeyValue "WIN.INI", "TrueMotion", "blackline", "ON" , cmoOverwrite
  248.     ELSE
  249.         CreateIniKeyValue "WIN.INI", "TrueMotion", "blackline", "OFF" , cmoOverwrite
  250.     END IF
  251.  
  252.  
  253.    
  254.     CreateDir DEST$, cmoNone
  255.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  256.     NewSrcDir$ = SrcDir$ + "drivers\"
  257.     AddSectionFilesToCopyList "Files", NewSrcDir$, DEST$
  258.     CopyFilesInCopyList
  259.  
  260.     SystemINI$ = DEST$ + "SYSTEM.INI"
  261.     CreateIniKeyValue SystemINI$, "drivers", "vidc.tmot", "truemo.drv" , cmoOverwrite
  262.  
  263.     RetVal% = FFindINIKeyAndVal(SystemINI$ , "386Enh", "device=dva.386")    
  264.  
  265.     IF RetVal% = 0 THEN
  266.        CreateSysIniKeyValue SystemINI$, "386Enh", "device", "dva.386" , cmoOverwrite
  267.     END IF
  268.  
  269. END SUB
  270.  
  271.  
  272.  
  273. '**
  274. '** Purpose:
  275. '**     Appends a file name to the end of a directory path,
  276. '**     inserting a backslash character as needed.
  277. '** Arguments:
  278. '**     szDir$  - full directory path (with optional ending "\")
  279. '**     szFile$ - filename to append to directory
  280. '** Returns:
  281. '**     Resulting fully qualified path name.
  282. '*************************************************************************
  283. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  284.     IF szDir$ = "" THEN
  285.         MakePath = szFile$
  286.     ELSEIF szFile$ = "" THEN
  287.         MakePath = szDir$
  288.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  289.         MakePath = szDir$ + szFile$
  290.     ELSE
  291.         MakePath = szDir$ + "\" + szFile$
  292.     END IF
  293. END FUNCTION
  294.  
  295.